package com.txd.mofa.wode.aty;


import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.kongzue.baseframework.interfaces.Layout;
import com.kongzue.baseframework.util.JumpParameter;
import com.kongzue.baseokhttp.HttpRequest;
import com.kongzue.baseokhttp.listener.ResponseListener;
import com.kongzue.baseokhttp.util.Parameter;
import com.ninetaildemonfox.zdl.ninetails.map.JSONUtils;
import com.txd.mofa.R;
import com.txd.mofa.base.BaseAty;
import com.txd.mofa.net.NetUtils;

import java.util.ArrayList;
import java.util.Map;

@Layout(R.layout.aty_guanyu)
public class GuanyuAty extends BaseAty {

    private ImageView iv_back,iv_logo;
    private TextView tv_name,tv_banben,tv_txt;

    @Override
    public void initViews() {
        super.initViews();

        iv_back = findViewById(R.id.iv_back);
        iv_logo = findViewById(R.id.iv_logo);
        tv_name = findViewById(R.id.tv_name);
        tv_banben = findViewById(R.id.tv_banben);
        tv_txt = findViewById(R.id.tv_txt);
    }

    @Override
    protected void onNetworkConnected(NetUtils.NetType type) {

    }

    @Override
    protected void onNetworkDisConnected() {

    }

    @Override
    public void initDatas(JumpParameter paramer) {

    }

    @Override
    protected void onResume() {
        super.onResume();
        http();
    }

    private void http() {
        HttpRequest.POST(me, aboutUs, new Parameter(), new ResponseListener() {
            @Override
            public void onResponse(String response, Exception error) {
                if (error == null) {
                    Map<String, String> map = JSONUtils.parseKeyAndValueToMap(response);
                    if (map.get("code").equals("1")){
                        Map<String, String> data = JSONUtils.parseKeyAndValueToMap(map.get("data"));

                        Glide.with(me).load(data.get("logo")).into(iv_logo);
                        tv_name.setText(data.get("app_name"));
                        tv_txt.setText(data.get("app_intro"));
                        tv_banben.setText(data.get("app_version"));
                    }


                }else {
                    toast("网络异常");
                }
            }
        });
    }

    @Override
    public void setEvents() {

        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
